package com.liwei.ssm.service;

import com.liwei.ssm.mapper.SchoolMapper;
import com.liwei.ssm.mapper.UserMapper;
import com.liwei.ssm.model.SchoolBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * Created by Liwei on 2015/11/23.
 */
@Service
public class UserService {

    @Autowired
    private UserMapper userMapper;

    @Autowired
    private SchoolMapper schoolMapper;


    public void queryUserCount(){
        int userCount = userMapper.queryUserCount(1);
        SchoolBean schoolBean = schoolMapper.selectById(1);
        System.out.println("查询用户数量 =>" + userCount);
        System.out.println("schoolBean =>" +schoolBean);
    }


    public void queryAllSchoolBeans(){
        List<Map<String,Object>> schoolList = schoolMapper.selectAllSchool();
        for (Map<String,Object> schoolMap : schoolList){
            System.out.println(schoolMap.get("school_name"));
        }
    }
}
